package danny.hoi.web.controller.base;

import danny.hoi.domain.export.system.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
public class BaseController {
    @Autowired
    protected HttpServletRequest request;
    @Autowired
    protected HttpServletResponse response;
    @Autowired
    protected HttpSession session;

    //获取登录账户
    public User getLoginUser() {
        return (User) session.getAttribute("loginUser");
    }

    //获取登录账户的企业id
    public String getLoginCompanyId() {
        return getLoginUser().getCompanyId();
    }

    //获取登录账户的企业名字
    public String getLoginCompanyName() {
        return getLoginUser().getCompanyName();
    }
}
